$(document).ready(function () {

    var obj = $.parseJSON(sessionStorage.obj);
    // alert(obj);
    $.each(obj, function (index, data) {
        if (data != "") {
            $(".products-row").append(showGoods(data));
        } else {

        }

    })
    $(".col-md-3 product-grids").appendTo("<div class='clearfix'> </div>");


});

function showGoods(goods) {
    return $("<div class='col-md-3 product-grids'><div class='agile-products'>+<div class='new-tag'><h6>" +
        "18%" +
        "<br>促销</h6></div><a href='single.jsp'> <img src='" + goods.goodsimg + "' class='img-responsive' alt='img'></a><div class='agile-product-text'><h5><a href='single.jsp'>" +
        goods.goodsname +
        "</a></h5><h6><del>" +
        "原价" + "</del>" +
        "折扣价" +
        "</h6> <input type='hidden' name='cmd' value='_cart'/><input type='hidden' name='add' value='1'/>" +
        "<input type='hidden' name='w3ls_item' value='" + goods.goodsname + "'/>" +
        "<input type='hidden' name='amount' value='" +
        "商品价格隐藏域" +
        "'/><button type='submit' class='w3ls-cart pw3ls-cart'> <i class='fa fa-cart-plus' aria-hidden='true'></i> 添加到购物车 </button></form>+</div>\n</div></div>")

}